<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  function fn(){
    console.log(this);
  }

  fn();     // window，默认绑定
  
  var obj = {name:"obj"}
  obj.fn = fn
  obj.fn();     // obj，隐式绑定

  var foo = {name:"foo"}
  foo.fn = obj.fn;
  foo.fn();     // foo，隐式绑定

  var obj2 = {
    name:"obj2",
    fn:function( a ){
      a();      // window，默认绑定
    }
  }
  obj2.fn( foo.fn );

  setTimeout( foo.fn, 1000 );     // window，默认绑定

  document.onclick = function(){
    foo.fn();
  }   // foo，隐式绑定

  document.oncontextmenu = (function(){
    return foo.fn;
  })();      // document，隐式绑定

  var foo2 = {
    name:"foo2",
    fn:function(){
      return obj.fn;
    }
  }
  foo2.fn()();      // window

  var b = foo2.fn();
  b();    // window

  // 1. 写出所有的this指向情况
  // 2. 归纳当前指向属于默认绑定？隐式绑定？
  
</script>
</html>